﻿using System;
using System.Windows.Forms;

namespace UserManage
{
    public partial class AddUser : Form
    {
        private UserIndex UI;

        public AddUser(UserIndex parent)
        {
            InitializeComponent();
            UI = parent;
        }

        /// <summary>
        /// 新增用户方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text))
            {
                MessageBox.Show("请刷卡...");
                return;
            }
            if (textBox1.Text.Length <= 3)
            {
                MessageBox.Show("刷卡数据不对...");
                return;
            }
            UI.AddUser(new UserInfo { User = textBox1.Text });
            Close();
        }
    }
}
